package com.woniu05.comparabl;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Person implements Comparable<Person> {
    private String name;
    private int age;



    @Override
    public int compareTo(Person other) {
        return Integer.compare(this.age, other.age); // 按年龄排序
    }

}
